#!/usr/bin/env bash
# Check that Cobbler can add and remove distros

source ${SYSTESTS_PRELUDE} && prepare

set -x -e -o pipefail

distro_names=(fake-1 fake-2)

for name in ${distro_names[@]}; do
	cobbler distro add --name ${name} --arch x86_64 --kernel ${fake_kernel} \
		--initrd ${fake_initramfs}
done

[ $(cobbler distro list | wc -l) = ${#distro_names[@]} ]

for name in ${distro_names[@]}; do
	cobbler distro remove --name ${name}
done

[ $(cobbler distro list | wc -l) = 0 ]
